home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEimageTemplate.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  7.5 KB  |  284 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //
  20. //  Creation Date:    May 15, 1997
  21. //  Author:        sw
  22. //
  23. //  Procedure Name:
  24. //    AEimageTemplate
  25. //
  26. //  Description Name;
  27. //    Creates the attribute editor controls for the image Node
  28. //
  29. //  Input Value:
  30. //    nodeName 
  31. //
  32. //  Output Value:
  33. //    None
  34. // 
  35.  
  36.  
  37. //
  38. //  Procedure Name:
  39. //    AEassignImageCB
  40. //
  41.  
  42. global proc int AEassignImageCB( string $type,
  43.                                  string $fileAttribute,
  44.                                  string $filename,
  45.                                  string $fileType )
  46. {
  47.     setAttr $type 0;
  48.     setAttr $fileAttribute -type "string" $filename;
  49.  
  50.     string $currentDir = `workspace -q -dir`;
  51.     retainWorkingDirectory ($currentDir);
  52.  
  53.     return true;
  54. }
  55.  
  56. //
  57. //  Procedure Name:
  58. //  AEimageBrowser
  59. //
  60.  
  61. global proc AEimageBrowser( string $cmd )
  62. {
  63.     string  $workspace = `workspace -q -fn`;
  64.     setWorkingDirectory $workspace "image" "sourceImages";
  65.  
  66.     fileBrowser ($cmd, "Open", "image", 100);
  67. }
  68.  
  69. //
  70. //  Procedure Name:
  71. //    AEinputNameNew
  72. //
  73.  
  74. global proc AEinputNameNew (string $type, string $fileAttribute)
  75. {
  76.     setUITemplate -pst attributeEditorTemplate;
  77.     rowLayout -nc 3 textureNameLayout;
  78.         text -l "Input Name";
  79.         textField textureNameField;
  80.             symbolButton -image "navButtonBrowse.xpm" browser;
  81.         setParent ..;
  82.     setUITemplate -ppt;
  83.  
  84.     AEinputNameReplace $type $fileAttribute;
  85. }
  86.  
  87. //
  88. //  Procedure Name:
  89. //    AEinputNameReplace
  90. //
  91.  
  92. global proc AEinputNameReplace (string $type, string $fileAttribute)
  93. {
  94.     connectControl textureNameField $fileAttribute;
  95.  
  96.     string $command = "AEassignImageCB "+$type+" "+$fileAttribute;
  97.  
  98.     button -e -c
  99.         ("AEinputBrowser \"" + $command + "\"" ) browser;
  100. }
  101.  
  102. //
  103. //  Procedure Name:
  104. //    AEoutputNameNew
  105. //
  106.  
  107. global proc AEoutputNameNew (string $type, string $fileAttribute)
  108. {
  109.     setUITemplate -pst attributeEditorTemplate;
  110.     rowLayout -nc 3 textureNameLayout;
  111.         text -l "Output Name";
  112.         textField textureNameField;
  113.             symbolButton -image "navButtonBrowse.xpm" browser;
  114.         setParent ..;
  115.     setUITemplate -ppt;
  116.  
  117.     AEoutputNameReplace $type $fileAttribute;
  118. }
  119.  
  120. //
  121. //  Procedure Name:
  122. //    AEoutputNameReplace
  123. //
  124.  
  125. global proc AEoutputNameReplace (string $type, string $fileAttribute)
  126. {
  127.     connectControl textureNameField $fileAttribute;
  128.  
  129.     string $command = "AEassignImageCB "+$type+" "+$fileAttribute;
  130.  
  131.     button -e -c
  132.         ("AEoutputBrowser \"" + $command + "\"" ) browser;
  133. }
  134.  
  135. //
  136. //  Procedure Name:
  137. //    AEdisplayCurrentNew
  138. //
  139.  
  140. global proc AEdisplayCurrentNew( string $displayOnlyIfCurrent )
  141. {
  142.     setUITemplate -pst attributeEditorTemplate;
  143.     columnLayout;
  144.     string $collection = `radioButtonGrp -numberOfRadioButtons 1 
  145.                                 -label "Display " 
  146.                                 -label1 "looking through camera" displayOnlyIfCurrent`;
  147.     radioButtonGrp -numberOfRadioButtons 1 
  148.                                 -label1 "in all views" 
  149.                                 -shareCollection $collection displayOnlyIfCurrent1;
  150.     setUITemplate -ppt;
  151.  
  152.     AEdisplayCurrentReplace $displayOnlyIfCurrent;
  153. }
  154.  
  155. //
  156. //  Procedure Name:
  157. //    AEdisplayCurrentReplace
  158. //
  159.  
  160. global proc AEdisplayCurrentReplace( string $displayOnlyIfCurrent )
  161. {
  162.     int $allViews = !`getAttr $displayOnlyIfCurrent`;
  163.  
  164.     setUITemplate -pst attributeEditorTemplate;
  165.     radioButtonGrp -e
  166.         -onCommand1 ("setAttr "+$displayOnlyIfCurrent+" on")
  167.         displayOnlyIfCurrent;
  168.     radioButtonGrp -e
  169.         -onCommand1 ("setAttr "+$displayOnlyIfCurrent+" off")
  170.         displayOnlyIfCurrent1;
  171.  
  172.     if ($allViews == 0) {
  173.         radioButtonGrp -e -select 1 displayOnlyIfCurrent;
  174.     } else {
  175.         radioButtonGrp -e -select 1 displayOnlyIfCurrent1;
  176.     }
  177.     setUITemplate -ppt;
  178. }
  179.  
  180.  
  181. //
  182. //  Procedure Name:
  183. //    checkUseFrameExtension
  184. //
  185.  
  186. global proc checkUseFrameExtension ( string $nodeName ) 
  187. {
  188.     string $nodeAttr = $nodeName + ".useFrameExtension";
  189.     int $value = `getAttr $nodeAttr`;
  190.     
  191.     if ( $value == 1 ) {
  192.         editorTemplate -dimControl $nodeName "frameExtension" false;
  193.     } else {
  194.         editorTemplate -dimControl $nodeName "frameExtension" true;
  195.     }
  196. }
  197.  
  198. //
  199. //  Procedure Name:
  200. //    AEimageViewUpdateCallback
  201. //
  202. global proc AEimageViewUpdateCallback( string $imgPlane )
  203. {
  204.     $newAttr = ($imgPlane + ".message");
  205.     
  206.     string $cameras[] = `listConnections ($imgPlane + ".message")`;
  207.     if (size ($cameras) == 0) return;
  208.     
  209.     for ( $camera in $cameras ) {
  210.         string $panels[] = `getPanel -type "modelPanel"`;
  211.  
  212.         for ($modelPanel in $panels) {
  213.             string $modelCamera = `modelPanel -q -camera $modelPanel`;
  214.  
  215.             if ($modelCamera == $camera) {
  216.                 string $shapes[] = `listRelatives -shapes $modelCamera`;
  217.  
  218.                 for ($shape in $shapes) {
  219.                     string $editor = `modelPanel -q -modelEditor $modelPanel`;
  220.                     modelEditor -e -updateColorMode $editor;
  221.                     break;
  222.                 }
  223.             }
  224.         }
  225.     }
  226. }
  227.  
  228. //
  229. //  Procedure Name:
  230. //    AEimageTemplate
  231. //
  232. global proc AEimageTemplate ( string $nodeName )
  233. {
  234.     AEswatchDisplay $nodeName;
  235.     editorTemplate -beginScrollLayout;
  236.         editorTemplate -beginLayout "Image Attributes" -collapse 0;
  237.             editorTemplate -callCustom "AEdisplayCurrentNew" 
  238.                     "AEdisplayCurrentReplace" 
  239.                     "displayOnlyIfCurrent";
  240.  
  241.             editorTemplate -addControl "displayMode" "AEimageViewUpdateCallback";
  242.  
  243.             editorTemplate -addControl "colorGain";
  244.             editorTemplate -addControl "colorOffset";
  245.             editorTemplate -addControl "alphaGain";
  246.             editorTemplate -addSeparator;
  247.             
  248.             editorTemplate -addControl "type" "AEimageViewUpdateCallback";
  249.  
  250.             editorTemplate -callCustom "AEinputNameNew" "AEinputNameReplace"
  251.                     "type" 
  252.                     "inputName";
  253.             editorTemplate -callCustom "AEoutputNameNew" "AEinputNameReplace"
  254.                     "type" 
  255.                     "imageName";
  256.             editorTemplate -addControl "useFrameExtension" "checkUseFrameExtension";
  257.             editorTemplate -addControl "frameExtension";
  258.         editorTemplate -endLayout;
  259.  
  260.         editorTemplate -beginLayout "Placement Extras" -collapse 0;
  261.             editorTemplate -addControl "coverageX";
  262.             editorTemplate -addControl "coverageY";
  263.             editorTemplate -addControl "coverageOriginX";
  264.             editorTemplate -addControl "coverageOriginY";
  265.             editorTemplate -addSeparator;
  266.             editorTemplate -addControl "center";
  267.             editorTemplate -addControl "width";
  268.             editorTemplate -addControl "height";
  269.         editorTemplate -endLayout;
  270.  
  271.         // include/call base class/node attributes
  272.         AEdependNodeTemplate $nodeName;
  273.  
  274.         // suppressed attribute
  275.         editorTemplate -suppress "inputName";
  276.         editorTemplate -suppress "outputName";
  277.         editorTemplate -suppress "coverage";
  278.         editorTemplate -suppress "coverageOrigin";
  279.         editorTemplate -suppress "displayOnlyIfCurrent";
  280.  
  281.     editorTemplate -addExtraControls;
  282.     editorTemplate -endScrollLayout;
  283. }
  284.